﻿<%@ WebHandler Language="C#" Class="SYS_Store_sel" %>

using System;
using System.Web;
using System.Web.Script.Serialization;
using System.Data;
using System.Collections.Generic;
using System.Web.SessionState;

public class SYS_Store_sel : IHttpHandler,IRequiresSessionState {
    sqlhelp sql = new sqlhelp();
    SYS_Storeresult result = new SYS_Storeresult();
    string str = "";
    DataTable dt = new DataTable();
    List<SYS_Store> SYS_StoreList = new List<SYS_Store>();
    public void ProcessRequest (HttpContext context) {
        try{
            if (context.Session["comid"] == null)
            {
                result.code = "-1";
                result.msg = "用户未登录";
                unit.send(context, result);
                return;
            }

            string Id = context.Session["comid"].ToString();

            string where = "where Id = '" + Id + "'  and Enable = 1";
            
            str = "select * from SYS_Store  " + where;
                dt = sql.myDataSet(str).Tables[0];            
				int len = dt.Rows.Count;
                if (len > 0)
                {
                    SYS_Store _SYS_Store = new SYS_Store();

                    _SYS_Store.Id = dt.Rows[0]["Id"].ToString();
                    _SYS_Store.Code = dt.Rows[0]["Code"].ToString();
                    _SYS_Store.Name = dt.Rows[0]["Name"].ToString();
                    _SYS_Store.Tel = dt.Rows[0]["Tel"].ToString();
                    _SYS_Store.UserName = dt.Rows[0]["UserName"].ToString();
                    _SYS_Store.PassWord = dt.Rows[0]["PassWord"].ToString();
                    _SYS_Store.AuthorizeFlg = dt.Rows[0]["AuthorizeFlg"].ToString();
                    _SYS_Store.AvatarId = dt.Rows[0]["Avatar"].ToString();
                    _SYS_Store.Website = dt.Rows[0]["Website"].ToString();
                    _SYS_Store.PublicNum = dt.Rows[0]["PublicNum"].ToString();
                    _SYS_Store.Address = dt.Rows[0]["Address"].ToString();
                    _SYS_Store.LinkTel = dt.Rows[0]["LinkTel"].ToString();
                    _SYS_Store.Qualification = dt.Rows[0]["Qualification"].ToString();
                    _SYS_Store.Licence = dt.Rows[0]["Licence"].ToString();
                    _SYS_Store.NewPhoto = dt.Rows[0]["NewPhoto"].ToString();
                    _SYS_Store.CreateTime = dt.Rows[0]["CreateTime"].ToString();
                    _SYS_Store.Enable = dt.Rows[0]["Enable"].ToString();

                    //查询动态对应图片
                    _SYS_Store.Avatar = unit.getImg(dt.Rows[0]["Avatar"].ToString());
                    
                    result.data = _SYS_Store;
                }
                else {
                    result.code = "0";
                    result.msg = "无数据";
                }
            }
            catch (Exception e1)
            {
                result.code = "0";
                result.msg = e1.Message;
            }
        unit.send(context, result);
    }

    public bool IsReusable {
        get {
            return false;
        }
    }

}

public class SYS_Storeresult : result
{
    public SYS_Store data = new SYS_Store();

}

public class SYS_Store {
    public string Id = "";
    public string Code = "";
    public string Name = "";
    public string AuthorizeFlg = "";
    public string Avatar = "";
    public string AvatarId = "";
    public string NewPhoto = "";
    public string CreateTime = "";
    public string Enable = "";
    public string Tel = "";
    public string UserName = "";
    public string PassWord = "";
    public string Website = "";
    public string PublicNum = "";
    public string Address = "";
    public string LinkTel = "";
    public string Qualification = "";
    public string Licence = "";
}
